<?php
// записей на страницу
$ext_ini=@parse_ini_file('ext/list/list.ini.php');
$ppp=@$ext_ini['ppp']?$ext_ini['ppp']:20;

if($posts = getapts()){

	rsort($posts);
	$pages = sizeof($posts) / $ppp;
	$skip = (isset($_v['skip']) && is_numeric($_v['skip']) ? $_v['skip'] : 0);
	if (sizeof($posts) > $ppp) $posts = array_slice($posts, $skip, $ppp);
	foreach ($posts as $p) if(is_numeric($p)) {
		$post = post_info($p);
		$post_id = $post['id'] + $_s['time_offset'];
		$post['admenu']=admenu($p);
		if (!@trim($post['title'])) $post['title']=$_l['notitle'];
		$moretitle = "";
		if(@gbuffer($post['id'],"close")) @$moretitle .= $_l['close_title'];
			if(@gbuffer($p,"close") && !ADMIN) {} 
			else echo '<p class="li">  <a href="'.generate_link('p='.$p).'#post">'.$post['title'].'</a> <span class="meta">'.$post['admenu'].$moretitle.' <a href="'.generate_link('p='.$p).'#comment">'.$_l['comments']." ".$post['c_count'].'</a> <span class="date">'.$post['date'].'</span></span></p>';
	}

	if ($pages > 1){
		$j=1;
		while($j <= $pages){
			$pn = $j + 1;
			if ($j*$ppp==$skip)$pages_link .= '<a href="'.generate_link('ext=list&skip='.$j*$ppp).'"><strong>'.$pn.'</strong></a> ';
			else $pages_link .= '<a href="'.generate_link('ext=list&skip='.$j*$ppp).'">'.$pn.'</a> ';
			$j++;
		}
		if($pages_link) echo '<a href="'.generate_link('ext=list').'">1</a> '.$pages_link;
	}
}
